package com.fbty.mt.action.user;

import com.fbty.base.action.BaseAction;
import com.fbty.base.domain.Page;
import com.fbty.mt.domain.Item;
import com.fbty.mt.domain.User;
import com.fbty.mt.service.ItemService;

public class ItemAction  extends BaseAction{
	
	private Page page;
	
	private Integer flag=0;
	
	private ItemService itemService;
	
	private int pageNo = 1;
	
	private int pageSize = 20;
	
	private int itemId;
	
	private Item item;
	public String queryItem(){
		User u = (User)sessionMap.get("user");
		if(u==null){
			return "login";
		}
		sessionMap.put("num", u.getNum());
		sessionMap.put("monthNum", u.getMonthnum());
		
		page = itemService.queryItems(pageNo, pageSize, flag,u.getId());
		return "query";
	}
	
	/**
	 * 订单页面，点重新付款时执行该方法
	 * @return
	 */
	public String repay(){
		item = itemService.finItemById(itemId);
		return "repay";
	}
	
	/**
	 * 取消订单
	 * @return
	 */
	public String delete(){
		itemService.deleteItem(itemId);
		return "delete";
	}

	
	public String showItem(){
		item = itemService.finItemById(itemId);
		return "item";
	}
	public Page getPage() {
		return page;
	}

	public Integer getFlag() {
		return flag;
	}

	public void setFlag(Integer flag) {
		this.flag = flag;
	}

	public void setItemService(ItemService itemService) {
		this.itemService = itemService;
	}

	public int getPageNo() {
		return pageNo;
	}

	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}

	public int getItemId() {
		return itemId;
	}

	public void setItemId(int itemId) {
		this.itemId = itemId;
	}


	public Item getItem() {
		return item;
	}

	
}
